{extend name="ashippingguide/Public/base" /}
{block name="container"}
<div class="page-heade">
    <h2 class="title_color text-center">导购薪资级别管理</h2>
</div>
<form action="" class="form-inline" id="form1" method="post">
    <table class="table table-bordered bud_hei">
        <tr>
            <td colspan="6"><a href="javascript:;" class="btn btn-sm btn-primary" id="addstaffnj">添加薪资级别</a><span class="lr_5"></span><a href="{:url('ashippingguide/import')}" class="btn btn-sm btn-info J_menuItem">导入导购薪资级别</a><span class="lr_5 colorRed">注：本功能用于导购人员薪资级别、导购费用申请模块。</span></td>
        </tr>
        <tr>
            <td>模糊查询：</td>
            <td>薪资级别：</td>
            <td><input type="text" class="form-control" name="salaryLevel" value="<?php if(isset($where['salaryLevel'])) echo $where['salaryLevel']; ?>"></td>
            <td>城市类别名称：</td>
            <td><input type="text" class="form-control" name="cityType" value="<?php if(isset($where['cityType'])) echo $where['cityType']; ?>"></td>
            <td>
                <button class="btn-sm btn-info btn" type="submit">查询</button><span class="lr_5"></span><button class="btn-sm btn-info btn" type="reset" id="reset">清空查询条件</button>
            </td>
        </tr>
    </table>

<table class="table table-striped table-bordered table-hover bud_hei text-center">
    <tr class="info">
        <th class="text-center" style="width: 4%">No.</th>
        <th class="text-center">薪资级别</th>
        <th class="text-center">城市类别名称</th>
        <th class="text-center">基本工资(元/月)</th>
        <th class="text-center">维护</th>
    </tr>
    <tbody style="border: 0">
    {volist name="data" id="list"}
    <tr>
        <td>{$i}</td>
        <td>{$list.salaryLevel}</td>
        <td>{$list.cityType}</td>
        <td class="ObjectNum">{$list.basePay}</td>
        <td><a href="javascript:;" class="modify" onclick="edit({$list.id})">修改</a>&nbsp;<a href="javascript:;" class="delthis" onclick="del({$list.id})">删除</a></td>
    </tr>
    {/volist}
    </tbody>
</table>
<h5 class="text-center"  style="font-size: 13px;font-weight: 500">
    总共有{$count}条记录，第{$page}/{$maxpage}页,当前页<input id="page" name="pages" type="text"  style="width: 40px" value=""/>
    <button id="gopage" type="submit">Go</button>&nbsp;&nbsp;<button id="fistpage" type="submit" onclick="$('#form_id').find('input').val('');">首页</button>&nbsp;&nbsp;
    每页显示
    <select id="pagesize" name="limts">
        <option value='10'>10条</option>
        <option value='15'>15条</option>
        <option value='20'>20条</option>

    </select>
    <script>
        $('#pagesize').val("{$limit}");
    </script>
</h5>
</form>
<div id="addtrainplanDiv" class="ibox-content" style="display: none">
    <form action="{:url('ashippingguide/add')}" class="form-inline" id="form2" method="post">
        <input type="hidden" name="id" value="" id="id">
        <table class="table table-bordered text-center">
            <tr>
                <td style="width: 140px">薪资级别名称<span class="colorRed">*</span></td>
                <td class="text-left"><input type="text" class="form-control validate[required]" id="salaryLevel" name="salaryLevel" value="<?php if(isset($where['salaryLevel'])) echo $where['salaryLevel']; ?>"></td>
            </tr>
            <tr>
                <td>基本工资(元/月)<span class="colorRed">*</span></td>
                <td class="text-left"><input type="text" class="form-control validate[required]" id="basePay" name="basePay" value="<?php if(isset($where['basePay'])) echo $where['basePay']; ?>"></td>
            </tr>
            <tr>
                <td>所属城市类别<span class="colorRed">*</span></td>
                <td class="text-left">
                    <select name="cityType" id="cityType" class="form-control select validate[required]">
                        <option value="">请选择城市类别</option>
                        <option value="一类城市">一类城市</option>
                        <option value="二类城市">二类城市</option>
                        <option value="三类城市">三类城市</option>
                    </select>
                    <script>
                        $('#cityType').val(<?php if(isset($where['basePay'])) echo $where['basePay']; ?>);
                    </script>
                </td>
            </tr>
        </table>
        <div class="padding-10 text-center">
            <button class="btn btn-primary" type="submit">提交</button><span class="lr_5"></span><button type="button" id="reset1" class="btn btn-info">重置</button><span class="lr_5"></span><button class="btn btn-warning" type="button" id="fanhui">返回</button>
        </div>
    </form>
</div>
<script>
    //表单验证
    $('#form2').validationEngine('attach', {
        promptPosition: 'bottomRight'
    });
    $("#addstaffnj").click(function(){
        layer.open({
            type: 1,
            title: '新增薪资级别',
            area: ['900px', '600px'],
            fixed: false, //不固定
            maxmin: true,
            content: $('#addtrainplanDiv')
            /*   yes: function (i, o) {
                   var param = $('#form1').serialize()
               $.post('/index/workflowdb/ysfy_cg.html', param, function (data) {
                   if (data.success) {
                       swal({title: data.msg}, function () {
                           layer.close(i)
                           location.reload()
                       })
                   } else {
                       swal(data.msg)
                   }
               }, 'json')
           }
*/
        });


    })
    /*职员年假重新计算*/
    $("#staffnjcount").click(function(){
        swal({
                title: "",
                text: "确定重新计算年假，将所有年假已支取天数将归零吗？",
                type: "warning",
                showCancelButton: true,
                confirmButtonColor: "#DD6B55",
                confirmButtonText: "确定！",
                closeOnConfirm: false
            },
            function(){
                swal("", "", "success");
            });
    })
    $(document).ready(function () {
        /*格式化数字金额*/
        var $ObjectNum =$(".ObjectNum");
        toNum($ObjectNum);
    })
    $('#reset').on('click',function () {
        $("#form1 input").each(function(){
            $(this).val('');
        });
        $("#form1 select").each(function(){
            $(this).val('');
        });
        $('#form1').submit()
        return false
    })
    $('#reset1').on('click',function () {
        $("#form2 input").each(function(){
            $(this).val('');
        });
        $("#form2 select").each(function(){
            $(this).val('');
        });

        return false
    })
    /*返回*/
    $('#fanhui').on('click',function () {
        // parent.layer.close(parent.layer.getFrameIndex(window.name))
        location.reload();
        return false
    })
    /*修改*/
    function edit(id){
        $('#id').val(id);
        $.get('{:url("ashippingguide/editP")}',{id:id},function (re){
            if (re.success) {
                $('#salaryLevel').val(re.data.salaryLevel);
                $('#basePay').val(re.data.basePay);
                $('#cityType').val(re.data.cityType);
            } else {
                sweetAlert("", re.msg, "error");
            }
        })
        layer.open({
            type: 1,
            title: '修改职员年假',
            area: ['900px', '600px'],
            fixed: false, //不固定
            maxmin: true,
            content: $('#addtrainplanDiv')
            /*   yes: function (i, o) {
                   var param = $('#form1').serialize()
               $.post('/index/workflowdb/ysfy_cg.html', param, function (data) {
                   if (data.success) {
                       swal({title: data.msg}, function () {
                           layer.close(i)
                           location.reload()
                       })
                   } else {
                       swal(data.msg)
                   }
               }, 'json')
           }
*/
        });
    }
//     $(document).on("click",".modify",function(){
//         layer.open({
//             type: 1,
//             title: '修改职员年假',
//             area: ['900px', '600px'],
//             fixed: false, //不固定
//             maxmin: true,
//             content: $('#addtrainplanDiv')
//             /*   yes: function (i, o) {
//                    var param = $('#form1').serialize()
//                $.post('/index/workflowdb/ysfy_cg.html', param, function (data) {
//                    if (data.success) {
//                        swal({title: data.msg}, function () {
//                            layer.close(i)
//                            location.reload()
//                        })
//                    } else {
//                        swal(data.msg)
//                    }
//                }, 'json')
//            }
// */
//         });
//
//     })
    /*删除*/

    // $(document).on("click",".delthis",function(){
    //     swal({
    //             title: "确定此操作吗？",
    //             text: "",
    //             type: "warning",
    //             showCancelButton: true,
    //             confirmButtonColor: "#DD6B55",
    //             confirmButtonText: "确定！",
    //             closeOnConfirm: false
    //         },
    //         function(){
    //             swal("", "", "success");
    //         });
    // })

    /*删除*/
    function del(id){
        swal({
            title: "",
            text: "您确定删除该条信息吗？",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            closeOnConfirm: true,
            closeOnCancel: true
        },function(){
            $.get('{:url("ashippingguide/del")}',{id:id},function (re){
                if (re.success) {
                    location.reload();
                } else {
                    sweetAlert("", re.msg, "error");
                }
            })
        });
    }


</script>

{/block}
